plat/arm: relocate the jump_if_cpu_midr macro.
authorDeepak Pandey <[email protected]>
Thu, 11 Oct 2018 08:14:43 +0000 (13:44 +0530)
committerDeepak Pandey <[email protected]>
Mon, 15 Oct 2018 07:38:52 +0000 (13:08 +0530)
macro jump_if_cpu_midr is used commonly by many arm platform.
It has now been relocated to common place to remove duplication
of code.

Change-Id: Ic0876097dbc085df4f90eadb4b7687dde7c726da
Signed-off-by: Deepak Pandey <[email protected]>
include/lib/cpus/aarch32/cpu_macros.S
include/lib/cpus/aarch64/cpu_macros.S
plat/arm/board/juno/aarch32/juno_helpers.S
plat/arm/board/juno/aarch64/juno_helpers.S
plat/arm/css/sgi/aarch64/sgi_helper.S
plat/arm/css/sgm/aarch64/css_sgm_helpers.S

index 7703be339dc4459d0ada7f6d59e5c90a4b28bfcf..525e18caf415d1664bd3eaf62c8826054fd37d9e 100644 (file)
        bl      errata_print_msg
        .endm
 #endif
+       /*
+        * Helper macro that reads the part number of the current CPU and jumps
+        * to the given label if it matches the CPU MIDR provided.
+        *
+        * Clobbers: r0-r1
+        */
+       .macro  jump_if_cpu_midr _cpu_midr, _label
+       ldcopr  r0, MIDR
+       ubfx    r0, r0, #MIDR_PN_SHIFT, #12
+       ldr     r1, =((\_cpu_midr >> MIDR_PN_SHIFT) & MIDR_PN_MASK)
+       cmp     r0, r1
+       beq     \_label
+       .endm
 
 #endif /* __CPU_MACROS_S__ */
index 026a48e32ea6ef9a28a00a8a32d58cc75259f6de..4672cbc061623e07e503ae2b71ec4b460680709f 100644 (file)
        cmp     \_reg, #1
        beq     \_label
        .endm
+
+       /*
+        * Helper macro that reads the part number of the current
+        * CPU and jumps to the given label if it matches the CPU
+        * MIDR provided.
+        *
+        * Clobbers x0.
+        */
+       .macro  jump_if_cpu_midr _cpu_midr, _label
+       mrs     x0, midr_el1
+       ubfx    x0, x0, MIDR_PN_SHIFT, #12
+       cmp     w0, #((\_cpu_midr >> MIDR_PN_SHIFT) & MIDR_PN_MASK)
+       b.eq    \_label
+       .endm
index 824002aedb130b7aef8a48b1554add2a1aa49bd9..1bc4e309a83aba6be9609425b2fb4c810eb924c6 100644 (file)
@@ -10,6 +10,7 @@
 #include <cortex_a53.h>
 #include <cortex_a57.h>
 #include <cortex_a72.h>
+#include <cpu_macros.S>
 #include <v2m_def.h>
 #include "../juno_def.h"
 
        beq     \_handler
        .endm
 
-       /* --------------------------------------------------------------------
-        * Helper macro that reads the part number of the current CPU and jumps
-        * to the given label if it matches the CPU MIDR provided.
-        *
-        * Clobbers r0.
-        * --------------------------------------------------------------------
-        */
-       .macro  jump_if_cpu_midr _cpu_midr, _label
-       ldcopr  r0, MIDR
-       ubfx    r0, r0, #MIDR_PN_SHIFT, #12
-       ldr     r1, =((\_cpu_midr >> MIDR_PN_SHIFT) & MIDR_PN_MASK)
-       cmp     r0, r1
-       beq     \_label
-       .endm
-
        /* --------------------------------------------------------------------
         * Platform reset handler for Juno R0.
         *
index 29c2c0a52f6c4ec95ab89410f9aa907d14129b68..edcfc7449127dfccc856c882f2b0a4dcf7e5d4b1 100644 (file)
        b.eq    \_handler
        .endm
 
-       /* --------------------------------------------------------------------
-        * Helper macro that reads the part number of the current CPU and jumps
-        * to the given label if it matches the CPU MIDR provided.
-        *
-        * Clobbers x0.
-        * --------------------------------------------------------------------
-        */
-       .macro  jump_if_cpu_midr _cpu_midr, _label
-       mrs     x0, midr_el1
-       ubfx    x0, x0, MIDR_PN_SHIFT, #12
-       cmp     w0, #((\_cpu_midr >> MIDR_PN_SHIFT) & MIDR_PN_MASK)
-       b.eq    \_label
-       .endm
-
        /* --------------------------------------------------------------------
         * Platform reset handler for Juno R0.
         *
index dd0fc5bbd26819b4dc626afd3d7f628f3bd3bdec..27bae43cf98c0713dcc7d0bb4c96d8460e49531a 100644 (file)
@@ -8,6 +8,7 @@
 #include <asm_macros.S>
 #include <platform_def.h>
 #include <cortex_a75.h>
+#include <cpu_macros.S>
 
        .globl  plat_arm_calc_core_pos
        .globl  plat_reset_handler
@@ -48,21 +49,6 @@ func plat_arm_calc_core_pos
        ret
 endfunc plat_arm_calc_core_pos
 
-       /* ------------------------------------------------------
-        * Helper macro that reads the part number of the current
-        * CPU and jumps to the given label if it matches the CPU
-        * MIDR provided.
-        *
-        * Clobbers x0.
-        * -----------------------------------------------------
-        */
-       .macro  jump_if_cpu_midr _cpu_midr, _label
-       mrs     x0, midr_el1
-       ubfx    x0, x0, MIDR_PN_SHIFT, #12
-       cmp     w0, #((\_cpu_midr >> MIDR_PN_SHIFT) & MIDR_PN_MASK)
-       b.eq    \_label
-       .endm
-
        /* -----------------------------------------------------
         * void plat_reset_handler(void);
         *
index d9b3df68d7a0f27888bbc2618539126da09aa9a3..32ca1bbc2501eb137ea8f127444796b4bc3ba953 100644 (file)
@@ -9,6 +9,7 @@
 #include <platform_def.h>
 #include <cortex_a75.h>
 #include <cortex_a55.h>
+#include <cpu_macros.S>
 
        .globl  plat_arm_calc_core_pos
        .globl  plat_reset_handler
@@ -50,21 +51,6 @@ func plat_arm_calc_core_pos
        ret
 endfunc plat_arm_calc_core_pos
 
-       /* ------------------------------------------------------
-        * Helper macro that reads the part number of the current
-        * CPU and jumps to the given label if it matches the CPU
-        * MIDR provided.
-        *
-        * Clobbers x0.
-        * -----------------------------------------------------
-        */
-       .macro  jump_if_cpu_midr _cpu_midr, _label
-       mrs     x0, midr_el1
-       ubfx    x0, x0, MIDR_PN_SHIFT, #12
-       cmp     w0, #((\_cpu_midr >> MIDR_PN_SHIFT) & MIDR_PN_MASK)
-       b.eq    \_label
-       .endm
-
        /* -----------------------------------------------------
         * void plat_reset_handler(void);
         *